# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=sd-tools
pkgver=0.99.0
pkgrel=0
pkgdesc="Standalone, cleaned up utilities from systemd"
url="https://github.com/chimera-linux/sd-tools"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	acl-dev
	clang
	libcap-dev
	meson
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/chimera-linux/sd-tools/archive/refs/tags/v$pkgver.tar.gz
	drop-bash-dep.patch
	"

case "$CARCH" in
	armhf|armv7|x86)
		options="$options !check";; # https://github.com/chimera-linux/sd-tools/issues/1
esac

export CC=clang

build() {
	abuild-meson . output
	meson compile -C output
}

check() {
	meson test --no-rebuild -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	install -Dm644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 LICENSE.LGPL2.1 -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
f82471a33f204766977c24a56c78ad41a295cb7b7c8190bdad4d40c45db67677c3bb2f71222fc02ca1c42653bc60b2cf742b0114b5bfc2d9efdfc238c866c52f  sd-tools-0.99.0.tar.gz
f64e1cc6b7f9ddcb97d13080e0e1b12841426247b1f27eee62bfda122e77c0673f669904c513bbebb94232b8f4c055fdbaa1b75c83294b1279ef7503fa9464ee  drop-bash-dep.patch
"
